/**
 * 
 */
package monitor;

import java.awt.BorderLayout;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 * @Description:  
 * @version: v1.0.0
 * @author: wbl
 * @date: 2019年10月23日 下午2:49:59
 */
public class Window extends JFrame {
	  private JTextField textFieldA;
	    private JTextField textFieldB;
	    private JTextField textFieldC;
	    private JTextArea resultArea;
	    private JButton caculateBtn;
	    //Listener
	    private Button1Listener simpleListener;
	
	    public Window()
	    {
	        //GUI部分
	        setLayout(new BorderLayout());//使用东南西北中布局
	     
	        textFieldA=new JTextField(5);
	        textFieldB=new JTextField(5);
	        textFieldC=new JTextField(5);
	        resultArea=new JTextArea();//
	        caculateBtn=new JButton("监控");
	        JPanel upPanel=new JPanel();//上面板
	        upPanel.add(new JLabel("代码"));
	        upPanel.add(textFieldA);
	        upPanel.add(new JLabel("下跌价格至"));
	        upPanel.add(textFieldB);
	        upPanel.add(new JLabel("上涨价格至"));
	        upPanel.add(textFieldC);
	        upPanel.add(caculateBtn);
	        add(upPanel,BorderLayout.NORTH);//将上面板加到该窗口的上部分
	        add(new JScrollPane(resultArea),BorderLayout.CENTER);//将结果的多行输出加入滚动面板，再把滚动面板加入该窗口的中部分
	        setVisible(true);
	        setDefaultCloseOperation(DISPOSE_ON_CLOSE);

	        
	        setBounds(100,100,460,260);
	        //设置监听器
	        simpleListener=new Button1Listener();
	        simpleListener.setResultArea(resultArea);
	        simpleListener.setTextFieldA(textFieldA);
	        simpleListener.setTextFieldB(textFieldB);
	        simpleListener.setTextFieldC(textFieldC);
	        
	        //添加监听器
	        caculateBtn.addActionListener(simpleListener);
	    }
	
	
}
